package cn.java8practise.lambda;

import org.omg.CORBA.INTERNAL;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;

/**
 * 使用函数式接口
 *
 * Created by 杨志远 on 2017/4/18
 * email faryangsh@163.com
 */
public class ComsumerTest {

    public static void main(String[] args) {
        forEach(Arrays.asList(1,2,3),(Integer i) -> System.out.println(i));

    }

    private static void forEach(List<Integer> list, Consumer<Integer> comsumer) {
        for(Integer i:list){
            comsumer.accept(i);
        }
    }
}
